//
//  CSFixImageTextButton.swift
//  Cycling
//
//  Created by CSS on 5/26/23.
//

import UIKit

@objc(CSFixImageTextButton)
class FixImageTextButton: UIButton {

    @objc var showType: ShowType = .imageTop
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        var imageSize:CGSize = imageView!.frame.size
        var titleSize:CGSize = titleLabel!.frame.size
        titleEdgeInsets = UIEdgeInsets(top: 0, left:-imageSize.width, bottom: -imageSize.height - 5, right: 0)
        imageEdgeInsets = UIEdgeInsets(top: -titleSize.height - 5, left: 0, bottom: 0, right: -titleSize.width)
    }
    
    @objc enum ShowType: Int {
        case imageTop, imageLeft, imageBottom, imageRight
    }
    
}
